﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace schedule
{
    public partial class Calendar : Form
    {
        likeCal LikeCal = null;
        DateTime now = DateTime.Now;

        public Calendar()
        {
            InitializeComponent();

            //윈도우 테두리 제거 방법
            this.FormBorderStyle = FormBorderStyle.None;

            // Form 상태 변경  
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
        }

        private void Calendar_Load(object sender, EventArgs e)
        {
            LikeCal = new likeCal();
            LikeCal.initDate(now);
            LikeCal.Dock = DockStyle.Fill;
            LikeCal.setRowColumns(6, 7);  //컬럼이 7개 로우가 6개 설정
            panel1.Controls.Add(LikeCal);
            LikeCal.setMonth(now);
            tbCurrent.Text = now.ToString("yyyy년도 MM월");
        }

        private void btnPrevMonth_Click(object sender, EventArgs e)
        {
            now = now.AddMonths(-1);
            LikeCal.setMonth(now);
            tbCurrent.Text = now.ToString("yyyy년도 MM월");
        }

        private void btnNextMonth_Click(object sender, EventArgs e)
        {
            now = now.AddMonths(1);
            LikeCal.setMonth(now);
            tbCurrent.Text = now.ToString("yyyy년도 MM월");
        }

        private void tbCurrent_MouseDown(object sender, MouseEventArgs e)
        {

        }

        private void btnToday_Click(object sender, EventArgs e)
        {
            setToday();
        }

        public void refreshScreen()
        {
            LikeCal.refreshScreen();
        }

        public void setToday()
        {
            now = DateTime.Now;
            LikeCal.setMonth(now);
            tbCurrent.Text = now.ToString("yyyy년도 MM월");
        }
    }
}
